import request from '@/router/axios';
import {exportFunc} from '@/api/export.js'
// 获取列表
export const getList = (current, size, params) => {
  return request({
    url: '/api/blade-purchase/settlementinfo/list',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  })
}

// 保存
export const save = (data) => {
  return request({
    url: '/api/blade-purchase/settlementinfo/save',
    method: 'post',
    data: data
  })
}

// 上传结算单
export const updateSettlementName = (data) => {
  return request({
    url: '/api/blade-purchase/settlementinfo/updateSettlementName',
    method: 'post',
    data: data
  })
}
// 上传发票
export const saveInvoice = (data) => {
  return request({
    url: '/api/blade-purchase/settlementinfo/saveInvoice',
    method: 'post',
    data: data
  })
}

//详情
export const detail = (id) => {
  return request({
    url: '/api/blade-purchase/settlementinfo/detail',
    method: 'get',
    params: {
      id
    }
  })
}
// 发布对账单
export const publish = (id) => {
  return request({
    url: '/api/blade-purchase/settlementinfo/publish',
    method: 'post',
    params: {
      id
    }
  })
}

// 启动流程
export const commit = id => {
  return request({
    url: `/api/blade-purchase/settlementinfo/start-process`,
    method: "post",
    params: { id }
  })
}

//导出
export const settlementSheetExport = (headers,id,name) => {
  exportFunc('/blade-purchase/settlementinfo/downloadSettlementInfo', headers, id, name)
}